import request from '@/utils/request'

// 查询计费模型列表
export function listModel(query) {
  return request({
    url: '/business/model/list',
    method: 'get',
    params: query
  })
}

// 查询计费模型详细
export function getModel(id) {
  return request({
    url: '/business/model/' + id,
    method: 'get'
  })
}

// 新增计费模型
export function addModel(data) {
  return request({
    url: '/business/model/save',
    method: 'post',
    data: data
  })
}

// 修改计费模型
export function updateModel(data) {
  return request({
    url: '/business/model',
    method: 'put',
    data: data
  })
}

// 删除计费模型
export function delModel(id) {
  return request({
    url: '/business/model/' + id,
    method: 'delete'
  })
}

// 查询设备类型
export function getDeviceType() {
  return request({
    url: 'business/model/device/type',
    method: 'get'
  })
}

// 绑定计费模型
export function bindModel(data) {
  return request({
    url: '/business/model/device/setting',
    method: 'post',
    data: data
  })
}

// 获取场站所有设备
export function getAllDevice() {
  return request({
    url: '/business/station/device/list' ,
    method: 'get'
  })
}

//协议类型列表
export function getProtocolList() {
  return request({
    url: '/business/model/all/ProtocolList' ,
    method: 'get'
  })
}

// 根据设备类型获取计费模型
export function getModelByProtocolName(protocolName) {
  return request({
    url: '/business/model/all/list/' + protocolName,
    method: 'get'
  })
}


// 修改计费模型
export function updateModelBind(data) {
  return request({
    url: '/business/manager/updateModel',
    method: 'put',
    data: data
  })
}
